querycache.qc_value column is used to store a numeric value related
to the query results, generally a COUNT(*) aggregation or timestamp,
but some query pages insert the page title here after passing it through
PHP's intval() function to parse it into a number.
While this will cause 0 to be inserted for pages whose title is not numeric
(i.e. most titles), a DB error may occur for numeric page titles that exceed
the maximum value for unsigned integers, depending on relevant DB settings,
such as MySQL's strict mode.[1]
This patch changes query pages not to insert page titles into the qc_value
column. Also, it adds the getOrderFields() method to query pages that were
missing them, to ensure that the result set inserted into the querycache
table is correctly ordered by title.
---
[1] https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html#sql-mode-strict
Bug: T181658
Change-Id: I1ef297257c6f419826ba4ffc6e875389ccec46db
'fields' => [
'namespace' => 'p1.page_namespace',
'title' => 'p1.page_title',
'fields' => [
'namespace' => 'p1.page_namespace',
'title' => 'p1.page_title',
- 'value' => 'p1.page_title',
'rd_namespace',
'rd_title',
'rd_fragment',
'rd_namespace',
'rd_title',
'rd_fragment',
'fields' => [
'namespace' => 'pa.page_namespace',
'title' => 'pa.page_title',
'fields' => [
'namespace' => 'pa.page_namespace',
'title' => 'pa.page_title',
- 'value' => 'pa.page_title',
'b_namespace' => 'pb.page_namespace',
'b_title' => 'pb.page_title',
'b_namespace' => 'pb.page_namespace',
'b_title' => 'pb.page_title',
'tables' => [ 'p1' => 'page', 'redirect', 'p2' => 'page' ],
'fields' => [ 'namespace' => 'p1.page_namespace',
'title' => 'p1.page_title',
'tables' => [ 'p1' => 'page', 'redirect', 'p2' => 'page' ],
'fields' => [ 'namespace' => 'p1.page_namespace',
'title' => 'p1.page_title',
- 'value' => 'p1.page_title',
'rd_namespace',
'rd_title',
'rd_fragment',
'rd_namespace',
'rd_title',
'rd_fragment',
'fields' => [
'namespace' => 'page_namespace',
'title' => 'page_title',
'fields' => [
'namespace' => 'page_namespace',
'title' => 'page_title',
- 'value' => 'page_title'
],
'conds' => $conds,
'join_conds' => $joinConds
],
'conds' => $conds,
'join_conds' => $joinConds
+ function getOrderFields() {
+ return [ 'title' ];
+ }
+
function getQueryInfo() {
return [
'tables' => [ 'page', 'categorylinks' ],
function getQueryInfo() {
return [
'tables' => [ 'page', 'categorylinks' ],
- 'fields' => [ 'namespace' => 'page_namespace',
+ 'fields' => [
+ 'namespace' => 'page_namespace',
- 'value' => 'page_title' ],
- 'conds' => [ 'cl_from IS NULL',
+ ],
+ 'conds' => [
+ 'cl_from IS NULL',
'page_namespace' => NS_FILE,
'page_namespace' => NS_FILE,
- 'page_is_redirect' => 0 ],
- 'join_conds' => [ 'categorylinks' => [
- 'LEFT JOIN', 'cl_from=page_id' ] ]
+ 'page_is_redirect' => 0,
+ ],
+ 'join_conds' => [
+ 'categorylinks' => [
+ 'LEFT JOIN',
+ 'cl_from=page_id',
+ ],
+ ],
'fields' => [
'namespace' => 'page_namespace',
'title' => 'page_title',
'fields' => [
'namespace' => 'page_namespace',
'title' => 'page_title',
- 'value' => 'page_title'
],
// default for page_namespace is all content namespaces (if requestedNamespace is false)
// otherwise, page_namespace is requestedNamespace
],
// default for page_namespace is all content namespaces (if requestedNamespace is false)
// otherwise, page_namespace is requestedNamespace
return $this->msg( 'unusedcategoriestext' )->parseAsBlock();
}
return $this->msg( 'unusedcategoriestext' )->parseAsBlock();
}
+ function getOrderFields() {
+ return [ 'title' ];
+ }
+
public function getQueryInfo() {
return [
'tables' => [ 'page', 'categorylinks' ],
'fields' => [
'namespace' => 'page_namespace',
'title' => 'page_title',
public function getQueryInfo() {
return [
'tables' => [ 'page', 'categorylinks' ],
'fields' => [
'namespace' => 'page_namespace',
'title' => 'page_title',
- 'value' => 'page_title'
],
'conds' => [
'cl_from IS NULL',
],
'conds' => [
'cl_from IS NULL',
+ function getOrderFields() {
+ return [ 'title' ];
+ }
+
public function getQueryInfo() {
return [
'tables' => [ 'page', 'templatelinks' ],
'fields' => [
'namespace' => 'page_namespace',
'title' => 'page_title',
public function getQueryInfo() {
return [
'tables' => [ 'page', 'templatelinks' ],
'fields' => [
'namespace' => 'page_namespace',
'title' => 'page_title',
- 'value' => 'page_title'
],
'conds' => [
'page_namespace' => NS_TEMPLATE,
],
'conds' => [
'page_namespace' => NS_TEMPLATE,
'fields' => [
'namespace' => 'page_namespace',
'title' => 'page_title',
'fields' => [
'namespace' => 'page_namespace',
'title' => 'page_title',
- 'value' => 'page_title'
],
'conds' => [
'll_title IS NULL',
],
'conds' => [
'll_title IS NULL',
'fields' => [
'namespace' => 'page_namespace',
'title' => 'page_title',
'fields' => [
'namespace' => 'page_namespace',
'title' => 'page_title',
- 'value' => 'page_title',
],
'conds' => [
0 => 'cl_from IS NULL',
],
'conds' => [
0 => 'cl_from IS NULL',